import requests

# 获取响应状态码
response = requests.get('https://www.baidu.com/')
print(response.status_code)

# 获取响应状态码的布尔值
print(response.ok)

# 判断响应状态码是否异常 没有异常则输出None
print(response.raise_for_status())